 <div class="h_top"><h2>订单评价</h2><a class="close_box">×</a></div>

    <div class="revise_evaluate_box">
        @if($order_product_comment)
            @foreach($order_product_comment as $k=>$v)
                <div class="left_box border_r">
                    <h2>买家评价</h2>
                    <div class="tit2">
                        总体评价：
                        @if($v['overall'] <= 1.5)
                            好评
                        @elseif($v['overall'] <= 2.5)
                            中评
                        @else
                            差评
                        @endif
                    </div>
                    <div class="tit">
                        <span>商品评价</span>
                        @for($i = 0; $i < 5; $i ++)
                            @if($i < $v['product_comment'])
                                <img src="{{asset('/img/web/inc/icon/star2.png')}}">
                            @else
                                <img src="{{asset('/img/web/inc/icon/star1.png')}}">
                            @endif
                        @endfor
                    </div>
                    <div class="tit">
                        <span>卖家服务</span>
                        @for($i = 0; $i < 5; $i ++)
                            @if($i < $v['seller_comment'])
                                <img src="{{asset('/img/web/inc/icon/star2.png')}}">
                            @else
                                <img src="{{asset('/img/web/inc/icon/star1.png')}}">
                            @endif
                        @endfor
                    </div>
                    <div class="tit">
                        <span>物流服务</span>
                        @for($i = 0; $i < 5; $i ++)
                            @if($i < $v['logistics_comment'])
                                <img src="{{asset('/img/web/inc/icon/star2.png')}}">
                            @else
                                <img src="{{asset('/img/web/inc/icon/star1.png')}}">
                            @endif
                        @endfor
                    </div>
                </div>
            @endforeach
        @else
            <div class="left_box border_r">
                <h2>买家暂未评价</h2>
            </div>
        @endif

        @if(empty($user_comment['data']))
            @if($user_comment['seller_is_comment']==1)
                <div class="left_box add_comment">
                    <h2>卖家评价</h2>
                    <div class="tit2">
                        <span>总体评价：</span>
                        <label><input type="radio" name="overall" class="seller_evaluation" value="1">好评</label>
                        <label><input type="radio" name="overall" class="seller_evaluation" value="2">中评</label>
                        <label><input type="radio" name="overall" class="seller_evaluation" value="3">差评</label>
                    </div>
                    <div class="tit">
                        <span>评价：</span>
                        <textarea name="comment" class="seller_comment"></textarea>
                    </div>
                </div>
            @else
                <div class="left_box ">
                    <h2>卖家评价</h2>
                    <div class="tit2">卖家未评价</div>
                </div>
            @endif
        @else
            <div class="left_box add_comment">
                <h2>卖家评价</h2>
                <div class="tit2">
                    <span>总体评价：</span>
                    <label><input type="radio" name="overall" class="seller_evaluation" {{$user_comment['data']['overall']==1?"checked='checked'":""}} value="1">好评</label>
                    <label><input type="radio" name="overall" class="seller_evaluation" {{$user_comment['data']['overall']==2?"checked='checked'":""}} value="2">中评</label>
                    <label><input type="radio" name="overall" class="seller_evaluation" {{$user_comment['data']['overall']==3?"checked='checked'":""}} value="3">差评</label>
                </div>
                <div class="tit">
                    <span>评价：</span>
                    <textarea name="comment" class="seller_comment">{{$user_comment['data']['comment']}}</textarea>
                </div>
            </div>
        @endif
    </div>
    @if(empty($user_comment['data']))
        @if($user_comment['seller_is_comment']==1)

            <div class="btn_box">
                <div class="btn_confirm fr" id="revise_evaluate_confirm" data-id="{{$order_id}}">确定</div>
                <div class="btn_cancel fr close_box">取消</div>
            </div>
        @endif

    @endif

<script>
    var create_comment_url = '/member/seller/orders/{id}/user_comment'

    //评价
    $('.close_box').click(function(){
        $('.bg_h').hide();
        $('#evaluate_bombbox').hide();
        $('.revise_evaluate_bombbox').hide();
    });

    $('#revise_evaluate_confirm').click(function(){
        var overall = $("input[type=radio]:checked").val();
        var comment = $('.seller_comment').val();
        if(!overall){
            layer.alert('请勾选评价', {
                icon: 2
            });
            return false;
        }

        if(!comment){
           layer.alert('请填写评价内容', {
               icon: 2
           });
            return false;

       }
        var order_id = $('#revise_evaluate_confirm').data('id');
        var url = create_comment_url.replace('{id}', order_id);

        $.ajax({
            url: url,
            type: 'POST',
            dataType: 'json',
            data: {'overall': overall, 'comment': comment},
            success: function (data) {
                if (0 == data.code) {
                    layer.alert("评价成功", {
                        icon: 1
                    }, function () {
                        location.reload();
                    });
                } else {
                    layer.alert(data.message, {
                        icon: 2
                    });
                }
            }
        });
    });
</script>